Skip to content

Conversation

balos1
Copy link
Member

@balos1 balos1 commented Sep 20, 2025

This is the changes that are needed to enable the Python interfaces without the bindings themselves included to make the review process easier.

@balos1 balos1 changed the base branch from develop to feature/python-interfaces September 22, 2025 17:33
@balos1
Copy link
Member Author

balos1 commented Sep 22, 2025

@gardner48 When this is merged into the feature/python-interfaces branch, I don't want the commits squashed so that I don't get a bunch of merge conflicts between this part1 branch and part2.

@balos1 balos1 removed the dont-merge label Sep 22, 2025
Copy link
Collaborator

@Steven-Roberts Steven-Roberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it through docs and include

  • For sunrealtype1d and similar typedefs, do we want to use them in docs or code only?
  • Changelog needs updating

* Programmer(s): Cody J. Balos @ LLNL
* -----------------------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2024, Lawrence Livermore National Security
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (c) 2002-2024, Lawrence Livermore National Security
* Copyright (c) 2002-2025, Lawrence Livermore National Security

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that this wasn't caught automatically by the copyright script.

{
void operator()(ARKodeButcherTable t)
{
if (t) { ARKodeButcherTable_Free(t); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (t) { ARKodeButcherTable_Free(t); }
ARKodeButcherTable_Free(t);

sunrealtype t, N_Vector f);
SUNDIALS_EXPORT int MRIStepInnerStepper_GetForcingData(
MRIStepInnerStepper stepper, sunrealtype* tshift, sunrealtype* tscale,
N_Vector** forcing, int* nforcing);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
N_Vector** forcing, int* nforcing);
N_Vector1d* forcing, int* nforcing);

* Programmer(s): Cody J. Balos @ LLNL
* -----------------------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2024, Lawrence Livermore National Security
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (c) 2002-2024, Lawrence Livermore National Security
* Copyright (c) 2002-2025, Lawrence Livermore National Security

{
void operator()(MRIStepCoupling t)
{
if (t) { MRIStepCoupling_Free(t); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (t) { MRIStepCoupling_Free(t); }
MRIStepCoupling_Free(t);


/* clang-format off */
enum
enum SUNErrCode_
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need some swig #ifdef that was used in a few other places?

*/

enum
enum SUN_GRAMSCHMIDT_ID
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question about swig ifdef

namespace sundials {
namespace experimental {

class SUNLoggerView : public sundials::ConvertibleTo<SUNLogger>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question about inheriting from ClassView. Would that require a major release?

}

private:
std::unique_ptr<SUNLogger> logger_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about using deleter template argument

typedef _SUNDIALS_STRUCT_ _generic_N_Vector* N_Vector;

/* Define array of N_Vectors */
typedef N_Vector* N_Vector_S;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we replace usages of N_Vector_S with N_Vector1d?

@gardner48 gardner48 added this to the SUNDIALS After Next milestone Sep 24, 2025
Copy link
Collaborator

@drreynolds drreynolds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I had a few questions, but I think these are more due to my lack of understanding than this needing corrections.

.. c:function:: SUNErrCode SUNDIALSFileClose(FILE** fp)
Deprecated alias to :c:func:`SUNFileOpen`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Deprecated alias to :c:func:`SUNFileOpen`
Deprecated alias to :c:func:`SUNFileClose`

Comment on lines -187 to 192

.. cpp:function:: N_Vector Convert() override
.. cpp:function:: N_Vector get() override

Explicit conversion to a :c:type:`N_Vector`.

.. cpp:function:: N_Vector Convert() const override
.. cpp:function:: N_Vector get() const override

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these constitute a breaking change? What was the need for changing the member function name?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this would be a breaking change. If the name change is necessary, we'll need to also provide Convert until the next major release.

Comment on lines +491 to +495
Deprecated alias to :c:func:`SUNFileOpen`.
.. c:function:: SUNErrCode SUNFileOpen(const char* filename, const char* mode, FILE** fp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment on the need to change SUNDIALSFileOpen and SUNDIALSFileClose to SUNFileOpen and SUNFileClose for this PR?

Comment on lines -305 to +309
SUNContext Convert() override
SUNContext get() override
{
return *sunctx_.get();
}
SUNContext Convert() const override
SUNContext get() const override
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, is this a breaking change? Why did the member function name need to be changed?

Comment on lines -142 to +146
.. cpp:function:: SUNLinearSolver Convert() override
.. cpp:function:: SUNLinearSolver get() override

Explicit conversion to a :c:type:`SUNLinearSolver`.

.. cpp:function:: SUNLinearSolver Convert() const override
.. cpp:function:: SUNLinearSolver get() const override
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change? Why the name change?

* Programmer(s): Cody J. Balos @ LLNL
* -----------------------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2024, Lawrence Livermore National Security
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that this wasn't caught automatically by the copyright script.

Comment on lines -173 to +182
typedef int (*MRIStepPreInnerFn)(sunrealtype t, N_Vector* f, int nvecs,
typedef int (*MRIStepPreInnerFn)(sunrealtype t, N_Vector1d f, int nvecs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc/shared/sundials/Types.rst introduced sunrealtypeNd and sunindextypeNd, but it never mentioned N_Vector1d -- should that be added?

Comment on lines +380 to +381
SUNDIALS_EXPORT int CVodeSetSensParams(void* cvode_mem, sunrealtype1d p,
sunrealtype1d pbar, int1d plist);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc/shared/sundials/Types.rst introduced sunindextype1d but not int1d -- should this be added to the documentation?

Comment on lines -570 to +572
N_Vector Convert() override { return object_.get(); }
N_Vector get() override { return object_.get(); }

N_Vector Convert() const override { return object_.get(); }
N_Vector get() const override { return object_.get(); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change? Why the name change?

Comment on lines -136 to +149
T Convert() override { return *object_.get(); }
T get() override { return object_; }

T Convert() const override { return *object_.get(); }
T get() const override { return object_; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that this is the cause for the member function changes elsewhere in our C++ headers. I don't fully follow the need for this, but I'm ready to take your word on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants